<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
 <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

		<link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
		<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
		<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

<script type="text/javascript" src="<%=basePath%>Js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/mycss/bootstrap.min.css" />
</head>

<script type="text/javascript">

function addRepertory(){
	
	var product = $("#product").val();
	var classify = $("#classify").val();
	var quantity = $("#quantity").val();
	var remarks = $("#remarks").val();
	
	$.ajax({
		type:"post",
		url:"<%=basePath%>addRepertory2.do",
		data:{
			"product":product,
			"classify":classify,
			"quantity":quantity,
			"remarks":remarks,
		},
		dataType:"text",
		success:function(result){
			if(result == "1"){
				alert("入库成功")
			}else{
				alert("入库失败")
			}
		},
		error:function(){
			alert("系统故障")
		}
		
	})
}





</script>

<body>
<hr><h3 align="center">添加库存</h3><hr>

	<div
		style="position: absolute; left: 400px; top: 150px; width: 400px; height: 100px">
       <form action="" id="myFrom">
		<table class="table table-bordered">
			<tr>
				<td>商品名称</td>
				<td><input type="text" class="form-control" id="product" placeholder="请输入商品名称"></td>
			</tr>
			<tr>
				<td>商品分类</td>
				<td><input type="text" class="form-control" id="classify" placeholder="请输入商品分类"></td>
			</tr>
			<tr>
				<td>数量</td>
				<td><input type="text" class="form-control" id="quantity" placeholder="请输入入库数量"></td>
			</tr>
			<tr>
				<td>备注</td>
				<td><textarea rows="5" cols="50" name="remarks" id="remarks" class="form-control"></textarea></td>
			</tr>

		</table>
		
		<div align="right">
		<button type="reset" form="myFrom" class="btn btn-danger">重置</button>
		<button type="button" class="btn btn-success" onclick="addRepertory()">添加库存</button>
		</div>
		</form>

	</div>

</body>
</html>